package com.sf.config;

import com.sf.web.intercptor.CheckLoginIntectpor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//@Configuration
public class MvcConfig implements WebMvcConfigurer {

    @Autowired
    private CheckLoginIntectpor checkLoginIntectpor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 1 把拦截器交给springmvc 来管理,   2 配置拦截规则  3 配置排除规则
        registry.
                addInterceptor(checkLoginIntectpor).
                addPathPatterns("/**").
                excludePathPatterns("/login.html","/login");
    }
}
